<?php /*a:1:{s:59:"E:\my_project\zhibo\application\index\view\index\index.html";i:1538100520;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>用户登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="/public/static/js/layui/css/layui.css">
    <link rel="stylesheet" href="/public/static/css/admin.css">
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <![endif]-->
</head>
<body class="login">
<div class="login-title">用户注册</div>
<div class="layui-form login-form"   >
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: red;">*</span>&nbsp;用户名</label>
        <div class="layui-input-block">
            <input type="password" name="userLoginName" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: red">*</span>&nbsp;密码</label>
        <div class="layui-input-block">
            <input type="password" name="userPassword" required lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color: red">*</span> 姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="register" lay-filter="*">登 录</button>
        </div>
    </div>
</div>

<form method="post" action="http://rykj.gensee.com/training/site/login" id="form1" style="display: none">
    <input type="hidden" name="redirectUrl" value="">
    <input type="hidden" name="errorUrl" value="">
    <input type="text" id="nameInput" name="name" value="">
    <input id="passwordInput" type="password" name="password" value="" >
</form>
<script src="/public/static/js/layui/layui.all.js"></script>
<script src="/public/static/js/jquery.min.js"></script>

<script type="text/javascript">
    $("#register").click(function () {
        var user = $.trim($("input[name='userLoginName']").val());
         var pass = $.trim($("input[name='userPassword']").val());
         var name = $.trim($("input[name='name']").val());
         if(user=='' || pass=='' || name==''){
             layer.open({
                 title: 'error'
                 ,content: '请将表单输入完整'
             });
             return
         }
        $.post("<?php echo url('index/index/register'); ?>",{userLoginName:user,userPassword:pass,name:name},function (rs) {

//            console.log(rs);
//            return;
//            if(rs.code == 0){
//                layer.open({
//                    title: 'error'
//                    ,content: rs.msg
//                });
//                return;
//            }

            if(rs.msg.code == 0 || rs.msg.message == 'loginName exists'){
                $("#nameInput").val(user)
                $("#passwordInput").val(pass)
                $("#form1").submit();
            }else{
                layer.open({
                    title: 'error'
                    ,content: rs.msg.message
                });
            }
        })
    })
</script>
</body>
</html>